<!DOCTYPE HTML />
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>个人中心</title>
    <link rel="stylesheet" href="/css/jquery.ui.core.css" type="text/css"/>
    <link rel="stylesheet" href="/css/jquery.ui.theme.css" type="text/css"/>
    <link rel="stylesheet" href="/css/fileuploader.css" type="text/css"/>
    <?php include_once("common/common_js.php") ?>
    <link rel="stylesheet" href="/css/jquery.ui.datepicker.css" type="text/css"/>
    <script src="/js/jquery.ui.core.min.js"></script>
    <script src="/js/jquery.ui.datepicker.js"></script>
    <script src="/js/fileuploader.js"></script>
    <script>

        $(function() {
            $("#birthDay").datepicker({dateFormat:"yy-mm-dd"});
            var uploader = new qq.FileUploader({
                // pass the dom node (ex. $(selector)[0] for jQuery users)
                element: document.getElementById('upload'),
                button:null,
                // path to server-side upload script
                action: '/index.php/ajax/upload',
                allowedExtensions: ["jpg", "png", "gif"],
                multiple:true,
// each file size limit in bytes
// this option isn't supported in all browsers

// set to true to output server response to console
                debug: false,
                onProgress: function(id, fileName, loaded, total) {
                },
                onComplete: function(id, fileName, responseJSON) {
                    $("#picturePreview").attr("src", responseJSON.url);
                    $("#picture").val(responseJSON.url);
                    $("#upload").text("已成功上传");
                    return false;
                },
                onCancel: function(id, fileName) {
                },

                messages: {
                    // error messages, see qq.FileUploaderBasic for content
                }
            });
        });
    </script>
    <?php
        if (array_key_exists("synCode", $view)) {
    echo $view['synCode'];
}
    ?>
</head>
<body>
<?php include_once("common/banner.php"); ?>
<div class="warpper">
    <?php include_once("common/header.php"); ?>
    <div class="al">
        <h3>会员资料</h3>

        <div class="content">
            <form action="/index.php/user/saveProfile" name="form1" method="post">
                <?php if (isset($this->_post['button']) && $this->_post['button'] == "保存") { ?>
                <p style="font-size: 18px; color:red">保存成功</p>
                <?php }?>
                <input name="userId" value="<?php echo $view['user']['userId'] ?>" type="hidden"/>
                <input name="avatar" id="picture" value="<?php echo  $view['user']['avatar']; ?>" type="hidden"/>
                <table>

                    <tr>
                        <td width="80">姓名</td>
                        <td width="350"><input type="text" value="<?php echo $view['user']['realName'] ?>"
                                               name="name" class="f_txt"/></td>
                        <td rowspan="6" style="text-align:center;">
                            <img src="<?php echo  $view['user']['avatar'] == '' ? '/images/temp.png'
                                    : $view['user']['avatar']  ?>" id="picturePreview"
                                 style="width:190px;margin-top:10px;"/>

                            <div style="clean:both">&nbsp;</div>
                            <a id="upload" style="margin-top:8px;">上传头像</a>
                        </td>
                    </tr>
                    <tr>
                        <td>昵称</td>
                        <td><input type="text" name="nickname" value="<?php echo $view['user']['nickName'] ?>"
                                   class="f_txt"/></td>
                    </tr>
                    <tr>
                        <td>姓别</td>
                        <td><select name="gender">
                            <option <?php if ($view['user']['gender'] == "男") echo "selected" ?> value="男">男
                            </option>
                            <option <?php if ($view['user']['gender'] == "女") echo "selected" ?> value="女">女
                            </option>
                        </select></td>
                    </tr>
                    <!--<tr>
                    <td>生日</td>
                    <td><input type="text" name="birthday" id="birthDay"
                               value="<?php /*echo $view['application']['birthday'] */?>" class="f_txt"/></td>
                </tr>
                <tr>
                    <td>爱好</td>
                    <td><input type="text" name="hobby" value="<?php /*echo $view['application']['hobby'] */?>"
                               class="f_txt"/></td>
                </tr>
                <tr>
                    <td>个性签名</td>
                    <td><input type="text" name="motto" value="<?php /*echo $view['application']['motto'] */?>"
                               class="f_txt"/></td>
                </tr>
                <tr>
                    <td>自我简介</td>
                    <td><textarea name="introduce"
                                  style="width:400px;height:200px"><?php /*echo $view['application']['introduce'] */?></textarea>
                    </td>
                </tr>
                <tr>
                    <td>身高</td>
                    <td><input type="text" name="height" value="<?php /*echo $view['application']['height'] */?>"
                               class="f_txt"/>（单位:厘米）
                    </td>
                </tr>
                <tr>
                    <td>体重</td>
                    <td><input type="text" name="weight" value="<?php /*echo $view['application']['weight'] */?>"
                               class="f_txt"/>（单位:公斤）
                    </td>
                </tr>
                <tr>
                    <td>三围></td>
                    <td>胸围:<input type="text" name="bust" value="<?php /*echo $view['application']['bust'] */?>"
                                  class="f_txt" style="width: 50px;"/>
                        腰围:<input type="text" name="waistline"
                                  value="<?php /*echo $view['application']['waistline'] */?>" class="f_txt"
                                  style="width: 50px;"/>
                        臀围:<input type="text" class="f_txt" value="<?php /*echo $view['application']['bust'] */?>"
                                  name="bust" style="width: 50px;"/>
                    </td>
                </tr>-->

                    <tr>
                        <td></td>
                        <td>
                            <input type="submit" name="button" value="保存" class="f_btn"/>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="al">
        <h3>会员账户设置</h3>

        <div class="content">
    <?php
                                        if (array_key_exists("message", $view)) {
        echo $view['message'];
    }
        ?>
        <form action="/index.php/user/savePassword" method="post" name="form1">
            <table>
                <tr>
                    <td>旧密码</td>
                    <td><input type="text" name="oldPassword"
                               class="f_txt"/>
                    </td>
                </tr>
                <tr>
                    <td>新密码</td>
                    <td><input type="text" name="newPassword"
                               class="f_txt"/>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>

                        <input type="submit" name="button" value="保存" class="f_btn"/>

                    </td>
                </tr>
            </table>
        </form>
        </div>
    </div>
    <div style="position:relative;">
        <div class="sl" style=" ">
            <h3>我投票的活动</h3>
            <!--我投票的活动-->
            <ul>

                <?php foreach ($view['myActivities'] as $value) { ?>
                <li>
                    <a href="/index.php/activities/show/<?php echo $value['activityId'] ?>"><?php echo $value['title'] ?></a>
                    <?Php
                                                                            $comment = $this->modules->Comment;
                    $comments = $comment->findByOperatorIdAndType($value['activityId'], 'ACTIVITY');
                    foreach ($comments as $comment) {
                        ?>
                        <div>
                            <span>我的评论：</span>

                            <p><?php echo $comment['content'] ?></p>
                        </div>

                        <?php } ?>


                </li>
                <?php } ?>
            </ul>
        </div>
        <div class="sl" style="position:absolute; left:420px;top:0">
            <h3>我评论的文章</h3>
            <ul>
                <?php foreach ($view['myNews'] as $value) { ?>
                <li>
                    <a href="/index.php/news/show/<?php echo $value['newsId'] ?>"><?php echo $value['title'] ?></a>
                    <?Php
                                                                            $comment = $this->modules->Comment;
                    $comments = $comment->findByOperatorIdAndType($value['newsId'], 'NEWS');
                    foreach ($comments as $comment) {
                        ?>
                        <div>
                            <span>我的评论：</span>

                            <p><?php echo $comment['content'] ?></p>
                        </div>

                        <?php } ?>


                </li>
                <?php } ?>

            </ul>

        </div>
    </div>
    <?php include("common/footer.php"); ?>
</div>
</body>
</html>